jsonEncodeForDisplay
Type
function
Summary
Converts a value to a string in JSON format, using appropriate whitespace to make it readable.
Syntax
jsonEncodeForDisplay(<pValue>)
Description
Use the jsonEncodeForDisplay function to convert a value into a string in JSON format when it is intended to be displayed for inspection.
Whitespace is used to space out values, in particular JSON arrays and JSON objects. Specifically:- a space is placed after ':' in object members
- a newline is placed after '{' and '['
- each element of an array, or member of an object, is placed on its own line
- each element of an array, or member of an object, is indented with tabs by its nesting depth
- '}' and ']' always appear on their own line, indented to the same depth as the line containing the corresponding '{' or '['.
For more details about LiveCode's JSON encoding support see jsonEncode.
Parameters
Name | Type | Description |
---|---|---|
pValue | The value to be converted to JSON format. |
Examples
put jsonEncodeForDisplay({ "a": [ 1, 2 ] })
-- outputs:
-- {
-- "a": [
-- 1,
-- 2
-- ]
-- }
Related
function: jsonEncode, jsonDecode, jsonEncodeUtf8, jsonDecodeUtf8, jsonEncodeForDisplay
Compatibility and Support
Introduced
LiveCode Create 1.0
OS
mac
windows
linux
ios
android
web
Platforms
desktop
server
mobile